﻿using System;

namespace Dsl.Ped.Controls.ProjectiveControl.Helpers
{
    /// <summary>
    /// Helper of the <see cref="Type"/>
    /// </summary>
    public static class TypeHelper
    {
        /// <summary>
        /// Get the type of a given name
        /// </summary>
        /// <param name="typeName">Name of a type</param>
        /// <returns>Type of a given name if resolved, null otherwise</returns>
        public static Type GetType(string typeName)
        {
            var type = Type.GetType(typeName);
            if (type != null) return type;
            foreach (var a in AppDomain.CurrentDomain.GetAssemblies())
            {
                type = a.GetType(typeName);
                if (type != null)
                    return type;
            }
            return null;
        }
    }
}
